package com.abner.mapper;

import com.abner.entity.User;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @description:
 * @author: GUOYN
 * @create: 2024/5/14 10:31
 */
@Transactional
public class UserMapperImpl extends SqlSessionDaoSupport implements UserMapper{
    @Override
    public List<User> UserList() {
        UserMapper userMapper = getSqlSession().getMapper(UserMapper.class);
        userMapper.addUser(new User(5,"书意","123456"));
        userMapper.deleteUser(5);

        return userMapper.UserList();

    }

    @Override
    public int addUser(User user) {
        return getSqlSession().getMapper(UserMapper.class).addUser(user);
    }

    @Override
    public int deleteUser(int id) {
        return getSqlSession().getMapper(UserMapper.class).deleteUser(id);
    }
}
